#ifndef USER_INFO_WIDGET_H
#define USER_INFO_WIDGET_H

#include <QDialog>
#include "ui_user_info_widget.h"
#include "user.h"

namespace Ui {
class UserInfoWidget;
}

class UserInfoWidget : public QWidget
{
    Q_OBJECT

    public:
    explicit UserInfoWidget(QWidget *parent = nullptr);
    ~UserInfoWidget();

    void setUserName(const QString &userName)
    {
        ui->userNameLabel->setText(userName);
    }

    void setUid(uint32_t uid)
    {
        ui->uidLabel->setText(QString::number(uid));
    }

    void setUserStatus(User::UserStatus status)
    {
        switch (status) {
        case User::OFFLINE:
            ui->userStatusLabel->setText("离线");
            break;
        case User::ONLINE:
            ui->userStatusLabel->setText("在线");
            break;
        case User::GAMEING:
            ui->userStatusLabel->setText("游戏中");
            break;
        default:
            ui->userStatusLabel->setText("未知状态");
            break;
        }
    }

private:
    Ui::UserInfoWidget *ui;
};

#endif // USER_INFO_WIDGET_H